package Demo02.Demo07;

import java.io.*;

public class Demo_picture {
    public static void main(String[] args) throws IOException {
        // 创建一个输入缓冲流
        InputStream in = new FileInputStream("F:\\文件\\A.png");
        BufferedInputStream bis = new BufferedInputStream(in);
        //创建一个输出缓冲流  此处采用匿名对象创建一个OutputStream对象作为缓冲流的参数
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("A.png"));// 默认的缓冲区大小8192
        byte[] buff = new byte[1024];
        int len;
        long begin= System.currentTimeMillis();
        while((len = bis.read(buff)) != -1){
            bos.write(buff,0,len);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制文件完成，共耗时：" + (end - begin) + "毫秒");//1
        bos.close();
        bis.close();


    }

    }

